package com.j2eefast.bussiness.contract.service;


import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.j2eefast.bussiness.contract.entity.BusInstallsEntity;
import com.j2eefast.bussiness.contract.entity.BusMeteringUnitEntity;
import com.j2eefast.bussiness.contract.mapper.BusInstallsMapper;
import com.j2eefast.bussiness.contract.mapper.BusMeteringUnitMapper;
import com.j2eefast.common.core.page.Query;
import com.j2eefast.common.core.utils.PageUtil;
import com.j2eefast.framework.sys.entity.SysUserEntity;
import com.j2eefast.framework.utils.Constant;
import com.j2eefast.framework.utils.UserUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


/**
 * <p>选项设置</p>
 *
 * @author: summer
 * @date: 2021-06-01 10:41
 * @web: http://www.letukeji.cn
 * @version: 1.0.1
 */

@Service
public class BusInstallsService extends ServiceImpl<BusInstallsMapper, BusInstallsEntity> {

    @Resource
    protected BusInstallsMapper busInstallsMapper;


    /**
     * 页面展示查询翻页
     */
    public PageUtil findPage(Map<String, Object> params) {
//		String sampleCode = (String) params.get("sampleCode");
		//String type = (String) params.get("type");


        Page<BusInstallsEntity> page = busInstallsMapper.findPage(
                new Query<BusInstallsEntity>(params).getPage(),
				//StrUtil.nullToDefault(type,""),
//				StrUtil.nullToDefault(sampleType,""),
                (String) params.get(Constant.SQL_FILTER));
        return new PageUtil(page);
    }

    public List<BusInstallsEntity> getInstallsList(){
        return busInstallsMapper.getInstallsList();
    }

    public boolean deleteByIds(Long[] ids) {

        return busInstallsMapper.deleteByIds(ids);

    }

    public boolean updateCheck(Long id) {
        Long userId= UserUtils.getUserInfo().getId();

        return busInstallsMapper.updateCheck(id ,userId);

    }
    public SysUserEntity getSysById(@Param("userId")Long userId){
        return busInstallsMapper.getSysById(userId);
    }







}
